﻿using System.Configuration;
using Sunny.UI;

namespace JFBG
{
    public partial class LoginForm : UILoginForm
    {
        private string username = "";

        private string password = "";

        private string username1 = "";

        private string password1 = "";

        private bool IsAdmin = false;

        public LoginForm()
        {
            InitializeComponent();

            this.username = ConfigurationManager.AppSettings["username"];
            this.password = ConfigurationManager.AppSettings["password"];

            this.username1 = ConfigurationManager.AppSettings["username1"];
            this.password1 = ConfigurationManager.AppSettings["password1"];
        }

        private void FLogin_ButtonLoginClick(object sender, System.EventArgs e)
        {
            if ((UserName == this.username) && (Password == this.password))
            {
                IsLogin = true;
                IsAdmin = true;
                Close();
            }
            else if ((UserName == this.username1) && (Password == this.password1))
            {
                IsLogin = true;
                Close();
            }
            else
            {
                this.ShowInfoTip("用户名或密码错误!");
            }
        }

        public bool GetIsAdmin()
        {
            return IsAdmin;
        }
    }
}